#ifndef PROGRAM_H
#define PROGRAM_H

#include "function.h"

class Function;//Forward Declaration
class AntlrAdapter;

/**
* \class Program
* \brief Holds the functions in the program and performs needed manipulation on them
* \author Elie M. Shaccour (elie.shaccour@gmail.com)
* 
*/
class Program{

private:
/*! A vector for all the functions in the program */
	std::vector<Function> Functions;
//holds the prgram path
	std::string DirectoryPath;
/*! Holds the ID of the program to be used when setting the test case */
	int DBIdentificationKey;
	AntlrAdapter *C_LR;

public:
        /**     \brief Constructor of the class
        *       \param Name Software testing profile name, unique identifier
        */
	Program(std::string ProjectPath);
	~Program();

        /**     \brief Process the data of the project and initialize the information needed 
        */
	void Process();

        /**     \brief Fetches the names of the function in the program 
        *       \return Functions names numbered
        */
	std::string GetFunctionNames();

        /**     \brief Returns the number of functions in the program 
        *       \return Number of function in the program 
        */
	int GetFunctionsCount();

        /**     \brief Returns the entire body of the function
        *       \param FunctionPosition Function number extracted from the previous menu whose data is needed
        *       \return string of the function body
        */
	std::string GetLinesOfFunctionAtPosition(int FunctionPosition);

        /**     \brief Returns the line in the specific function at the specified line 
        *       \param FunctionPosition Function number extracted from the previous menu whose data is needed
	*	\param LinePosition Function line of function number needed
        *       \return string of the line required
        */
	std::string GetFunctionLineAtPosition(int FunctionPosition,int LinePosition);

        /**     \brief Returns the scope of a specific line in a specific function 
        *       \param FunctionPosition Function number extracted from the previous menu whose data is needed
	*	\param LinePosition Line of function whose data is needed
        *       \return Scope of the required line in the specified function
        */
	int GetFunctionLineScopeAtPosition(int FunctionPosition, int LinePosition);

        /**     \brief Returns function name 
        *       \param FunctionPosition Function number extracted from the previous menu whose data is needed
        *       \return Function Name
        */
	std::string GetFunctionNameAtPosition(int FunctionPosition);

        /**     \brief Returns the position of the first line in the function in the file
        *       \param FunctionPosition The funcion needed
        *       \return Line position of the first line of the function
        */
	int GetFunctionFilePosition(int FunctionPosition);

        /**     \brief Each program/project is represented by a unique ID in the DB and this will return the ID
        *       \return ID of the program 
        */
	int GetDBIdentificationKey();

        /**     \brief Takes scope of line and line and returns the line number in the function
        *       \param FunctionPosition The function to search for
	*	\param LineScope the scope of the line being searched for
	*	\param LineDescription the string describing the targeted line 
	* 	\param DescriptionType the type of line we're searching for, whether a def or a use or etc...
        *       \return The new absolute position of the statement if found or -1 if not found
        */
	int FindLineNewPosition(int FunctionPosition, int LineScope, std::string LineDescription, std::string DescriptionType);

        /**     \brief Returns directory of the program
        */
	std::string GetDirectoryPath();
};

#endif
